#ifndef INCLUDED_MAP_H
#define INCLUDED_MAP_H
#include <SGE.h>
using namespace SGE;

class Map
{
	public:
		Map();
		~Map();
		void Load(const char* pLevel, const char* pTexturePack);
		void Unload();
		void Update(float deltaTime);
		void Render(const SVector2& viewOffset);
		void RenderIsometric(const SVector2& viewOffset);
		bool TestCollision(const SLineSegment& segment, SRect& rect) const;

		int getWidth() const	{return mColumns*mTileSizeW;}
		int getHeight() const	{return mRows*mTileSizeH;}

	private:
		bool LoadLevel(const char* pLevel);
		bool LoadTexturePack(const char* pTexturePack);
		
		int GetIndex(int x, int y) const;
		bool IsBlocked(int x, int y) const;
		SRect GetBoundingBox(int x, int y) const;

		SGE_Sprite *mpSprites;
		int* mpTiles;

		int mNumSprites,
			mTileSizeH,
			mTileSizeW,
			mColumns,
			mRows;
};

#endif